// 引入request模块
import requests from '@/api/requests'
// 引入mockRequest模块
import mockRequest from '@/api/mockRequest'

// 三级分类请求
export const reqgetCategory=() => requests({url:'/product/getBaseCategoryList',method:'get'})

// banner请求
export const reqgetBanner=()=> mockRequest({url:'/banner',method:'get'})

// floor请求
export const reqgetFloor=()=> mockRequest({url:'/floor',method:'get'})

// search请求 数据可以为空，如果没有数据就会api请求失败
export const reqgetSearch=(params)=> requests({url:'/list',method:'post',data:params})

// detail请求
export const reqgetGoods=(id)=>requests({url:`/item/${id}`,method:'get'})

// 加入购物车数据添加请求
export const reqAddCart=(skuId,skuNum)=>requests({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'})

// 购物车列表数据请求
export const reqgetCartList=()=>requests({url:'/cart/cartList',method:'get'})

// 删除购物车商品
export const reqDelCartGoods=(skuId)=>requests({url:`/cart/deleteCart/${skuId}`,method:'delete'})

// 修改购物车商品状态
export const reqUpdateCartGoods=(skuId,isChecked)=>requests({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

// 获取手机验证码
export const reqGetPhoneCode=(phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:'get'})

// 注册用户
export const reqUserRegister=(data)=>requests({url:'/user/passport/register',method:'post',data})

// 登录用户
export const reqUserLogin=(data)=>requests({url:'/user/passport/login',method:'post',data})


//获取用户信息【需要带着用户的token向服务器要用户信息】
//URL:/api/user/passport/auth/getUserInfo  method:get 
export const reqgetUserInfo=()=>requests({url:'/user/passport/auth/getUserInfo',method:'get'})

// 退出登录
export const reqUserLogout=()=>requests({url:'/user/passport/logout',method:'get'})

// /api/user/userAddress/auth/findUserAddressList
// 获取用户地址信息
// export const reqgetUserAddressList=()=>requests({url:'/user/userAddress/auth/findUserAddressList',method:'get'})

// mock用户地址信息
export const reqgetUserAddressList=()=>mockRequest({url:'/userAddressList',method:'get'})

// 获取订单列表
// /api/order/auth/trade
export const reqgetTradeList=()=>requests({url:'/order/auth/trade',method:'get'})

// 提交订单
// /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqsubmitOrder=(tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data})

// 获取订单支付信息
// /api/payment/weixin/createNative/{orderId}
export const reqgetPayInfo=(orderId)=>requests({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

// 14. 查询支付订单状态
// /api/payment/weixin/queryPayStatus/{orderId}
export const reqqueryPayStatus=(orderId)=>requests({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'})

// 11. 获取我的订单列表
// /api/order/auth/{page}/{limit}
export const reqgetMyOrderList=(page,limit)=>requests({url:`/order/auth/${page}/${limit}`,method:'get'})